package com.yaoli.ajob;

/**
 * Created by siemens on 4/28/2017.
 */
public class _406_QueueReconstructionbyHeight {
    public static void main(String[] args) {
        int matrix[][] = {{7, 0}, {4, 4}, {7, 1}, {5, 0}, {6, 1}, {5, 2}};

        // [7,0] [7,1]  [6,1] [5,0] [5,2] [4,4]

        // [5,0]  [7,0]  [5,2] [6,1]  [4,4] [7,1]
        _406_QueueReconstructionbyHeight queueReconstructionbyHeight = new _406_QueueReconstructionbyHeight();


        queueReconstructionbyHeight.reconstructQueue(matrix);
    }

    public int[][] reconstructQueue(int[][] people) {
        for(int i = 0 ; i < people.length - 1 ; i++){
            for(int j = i + 1 ; j < people.length ;j++){

                if(people[i][0] < people[j][0]){
                    int temp [] = people[i];
                    people[i] = people[j];
                    people[j] = temp;
                }

            }
        }

        for(int i = 0 ; i < people.length ; i++){

        }
        return people;
    }
}
